// source --> http://caffe-luce.com/wp-content/plugins/wp-post-modal/public/js/wp-post-modal-public.js?ver=1.0.0 (function ($) { 'use strict'; /** * Check if URL is external function * * @returns {boolean} */ $.fn.isExternal = function () { var host = window.location.hostname; var link = $('', { href: this.attr('href') })[0].hostname; return (link !== host); }; /** * Check if modal is open */ function popupOpen() { return $('#modal-content').html().length; } /** * Basename function for JS * * @param path * @param suffix * @returns {*} */ function basename(path, suffix) { var b = path; var lastChar = b.charAt(b.length - 1); if (lastChar === '/' || lastChar === '\\') { b = b.slice(0, -1); } b = b.replace(/^.*[/\\]/g, ''); if (typeof suffix === 'string' && b.substr(b.length - suffix.length) === suffix) { b = b.substr(0, b.length - suffix.length); } return b; } /** * Get URL Paramenters * * @param sParam * @returns {*} */ var getUrlParameter = function getUrlParameter(sParam) { var sPageURL = decodeURIComponent(window.location.search.substring(1)), sURLVariables = sPageURL.split('&'), sParameterName, i; for (i = 0; i < sURLVariables.length; i++) { sParameterName = sURLVariables[i].split('='); if (sParameterName[0] === sParam) { return sParameterName[1] === undefined ? true : sParameterName[1]; } } }; /** * Suppress modal link redirect in WP Customizer */ function modalCustomizer() { if (typeof wp.customize !== 'undefined') { var body = $('body'); body.off('click.preview'); body.on('click.preview', 'a[href]:not(.modal-link)', function (e) { var link = $(this); e.preventDefault(); wp.customize.preview.send('scroll', 0); wp.customize.preview.send('url', link.prop('href')); }); } } // Document Ready $(function () { // Detect windows width function var $window = $(window), $document = $(document), scrollPos, currentURL = window.location.pathname; /** * Show modal functionality */ function showModal(postLink, external) { scrollPos = window.pageYOffset; $('body, html').addClass('no-scroll'); $('.modal-wrapper').addClass('show'); $('.modal').addClass('show'); // update address bar to show url of popup content page if (postLink) { if (postLink.length > 0 && !external) { history.replaceState('', '', postLink); } } } /** * Close modal functionality */ function hideModal(currentURL) { var body = $('body'); if (body.hasClass('no-scroll')) { body.removeClass('no-scroll'); $('html').removeClass('no-scroll'); $('.modal-wrapper').removeClass('show').hide(); $('.modal').removeClass('show'); $('#modal-content').empty(); window.scroll(0, scrollPos); // return original page url in address bar if (window.location.pathname !== currentURL) { history.replaceState('', '', currentURL); } } } $document // Close modal when pressing esc .keyup(function (e) { if (e.keyCode === 27 && $('.modal-wrapper').hasClass('show')) hideModal(currentURL); }) // Close modal when clicking on close button .on('click', '.close-modal', function () { hideModal(currentURL); }) // when clicking outside of modal .on('click', '.modal', function (e) { e.stopPropagation(); }); // when clicking outside of modal $(window).on('click', function () { if (popupOpen()) hideModal(currentURL); }); /** * Check width */ function initModal() { // if the window is greater than breakpoint then show modal, otherwise go to linked page as normal if ($window.width() >= fromPHP.breakpoint) { var modalUrl = getUrlParameter('modal-link'); // if using URL parameter to open modal if (modalUrl) { // show loading animation if styling is turned on if (fromPHP.loader) { $('#modal-content').html(''); } $.get( modalUrl, function (html) { $('#modal-content').html($(html).find(fromPHP.containerID).html()); }); // show modal $('.modal-wrapper').fadeIn('fast', showModal); } /** * When clicking a modal-link */ $('body').on('click', '.modal-link', function (e) { // Define variables var modalContent = $('#modal-content'); var $this = ($(this).attr('href') != null) ? $(this) : $(this).children('a').first(); var postLink = $this.attr('href'); var postSlug = postLink.lastIndexOf('/#') > -1 ? basename(postLink.substring(0, postLink.lastIndexOf('/#'))) + basename(postLink) : basename(postLink); var postAnchor = postSlug.lastIndexOf('#') !== -1 ? postSlug.substring(postSlug.lastIndexOf('#')) : false; var dataDivID = ' #' + $this.attr('data-div'); var dataBuddypress = $this.attr('data-buddypress'); var loader = ''; // prevent link from being followed e.preventDefault(); // display loading animation or in this case static content if (fromPHP.loader) { modalContent.html(loader); } // Load content from external if ($this.isExternal()) { // load external content using iframe method if ($(this).hasClass('iframe') || fromPHP.iframe) { var iframeCode = ''; modalContent.html(iframeCode); } // load external content normally else { $.ajaxPrefilter(function (options) { if (options.crossDomain && jQuery.support.cors) { var http = (window.location.protocol === 'http:' ? 'http:' : 'https:'); options.url = http + '//cors-anywhere.herokuapp.com/' + options.url; //options.url = "http://cors.corsproxy.io/url=" + options.url; } }); $.get( postLink, function (html) { modalContent.html($(html).find(dataDivID).html()); }); } } // Load content from internal page else { // when loading buddy press profile if (dataBuddypress) { modalContent.load(postLink + ' #buddypress'); } // load internal content using iframe method else if ($(this).hasClass('iframe')) { var iframeCode = ''; modalContent.html(iframeCode); } // when loading any other type of content else { // use the rest method if (fromPHP.restMethod || $(this).hasClass('rest')) { $.get( fromPHP.siteUrl + '/wp-json/wp-post-modal/v1/any-post-type?slug=' + postSlug, function (response) { $.when(modalContent.html(response.post_content)).done(function () { // scroll to anchor setTimeout(function () { if (postAnchor) { $('.modal-wrapper').animate({ scrollTop: ($('#modal-content ' + postAnchor).offset().top) }, 300); } }, 200); }); }); } // use the default method else { $.get( postLink, function (html) { var content = $(html).find(fromPHP.containerID); if (content[0]) { $.when(modalContent.html($(html).find(fromPHP.containerID).html())).done(function () { // scroll to anchor setTimeout(function () { if (postAnchor) { $('.modal-wrapper').animate({ scrollTop: ($('#modal-content ' + postAnchor).offset().top) }, 300); } }, 200); }); } // fallback to load method else { modalContent.load(postLink, function () { modalContent.html($(modalContent.html()).find(fromPHP.containerID).html()); setTimeout(function () { if (postAnchor) { $('.modal-wrapper').animate({ scrollTop: ($('#modal-content ' + postAnchor).offset().top) }, 300); } }, 200); }); } }); } } } // show modal $('.modal-wrapper').fadeIn('fast', function () { // if url state plugin setting is active showModal(fromPHP.urlState ? postLink : '', $this.isExternal()); }); }); } } // Initiate modal initModal(); // Re-initiate modal on window resize $(window).resize(initModal); }); // Window load $(window).on('load', function () { modalCustomizer(); }); })(jQuery); // source --> http://caffe-luce.com/wp-content/plugins/wp-tripadvisor-review-slider/public/js/wprs-unslider-swipe.js?ver=10.2 !function(a){"object"==typeof module&&"object"==typeof module.exports?a(require("jquery")):"function"==typeof define&&define.amd?define([],a(window.jQuery)):a(window.jQuery)}(function(a){return a?(a.Unslider=function(b,c){var d=this;return d._="wprs_unslider",d.defaults={autoplay:!1,delay:3e3,speed:750,easing:"swing",keys:{prev:37,next:39},nav:!0,arrows:{prev:'Prev',next:'Next'},animation:"horizontal",selectors:{container:"ul:first",slides:"li"},animateHeight:!1,activeClass:d._+"-active",swipe:!0,swipeThreshold:.2},d.$context=b,d.options={},d.$parent=null,d.$container=null,d.$slides=null,d.$nav=null,d.$arrows=[],d.total=0,d.current=0,d.prefix=d._+"-",d.eventSuffix="."+d.prefix+~~(2e3*Math.random()),d.interval=null,d.init=function(b){return d.options=a.extend({},d.defaults,b),d.$container=d.$context.find(d.options.selectors.container).addClass(d.prefix+"wrap"),d.$slides=d.$container.children(d.options.selectors.slides),d.setup(),a.each(["nav","arrows","keys","infinite"],function(b,c){d.options[c]&&d["init"+a._ucfirst(c)]()}),jQuery.event.special.swipe&&d.options.swipe&&d.initSwipe(),d.options.autoplay&&d.start(),d.calculateSlides(),d.$context.trigger(d._+".ready"),d.animate(d.options.index||d.current,"init")},d.setup=function(){d.$context.addClass(d.prefix+d.options.animation).wrap('
'),d.$parent=d.$context.parent("."+d._);var a=d.$context.css("position");"static"===a&&d.$context.css("position","relative"),d.$context.css("overflow","hidden")},d.calculateSlides=function(){if(d.$slides=d.$container.children(d.options.selectors.slides),d.total=d.$slides.length,"fade"!==d.options.animation){var a="width";"vertical"===d.options.animation&&(a="height"),d.$container.css(a,100*d.total+"%").addClass(d.prefix+"carousel"),d.$slides.css(a,100/d.total+"%")}},d.start=function(){return d.interval=setTimeout(function(){d.next()},d.options.delay),d},d.stop=function(){return clearTimeout(d.interval),d},d.initNav=function(){var b=a('');d.$slides.each(function(c){var e=this.getAttribute("data-nav")||c+1;a.isFunction(d.options.nav)&&(e=d.options.nav.call(d.$slides.eq(c),c,e)),b.children("ol").append('